<!DOCTYPE html>
<html>
<head>
	<title><%= title%></title>
	<script type="text/javascript" src="/bower_components/jquery/dist/jquery.js"></script>
	<!-- <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.js"></script> -->
	<link rel="stylesheet" type="text/css" href="/bower_components/bootstrap/dist/css/bootstrap.css">
	<style type="text/css">
		h2{
			margin-top: 80px;
			margin-bottom: 40px;
			color: #FD5C63;
		}
	</style>
</head>
<body>
<div class="container">
	<div class="col-sm-4 col-sm-offset-4">
		<h2 class="text-center"><%= title%></h2>
		<form>
			<div class="form-group">
				<label>用户名：</label>
				<input type="text" class="form-control" id="user" name="name" placeholder="User Name">
			</div>
			<div class="form-group">
				<label>密码：</label>
				<input type="password" class="form-control" name="password" placeholder="Password">
			</div>
			<button id="submit" type="button" class="btn btn-info  btn-block">登陆</button>
			<a class="btn btn-block btn-warning" href="/users/signup">还未注册？</a>
		</form>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
	$(function(){
		$('#submit').click(function(){
			$.post("/users/login",
			{
				name: $('[name=name]').val(),
				password: $('[name=password]').val()
			},
			function(data,status){
				if (data=='ok') {
					window.location.href = "/";
				}else if (data=='admin') {
					window.location.href = "/admin";
				}else{
					alert(data)
				}
			})
		})
	});
</script>